package entity.fields.properties;

import controllers.FieldController;
import dto.PropertyField;


public class Shipping extends PropertyField {

	private final static int baseRent = 500;

	public Shipping(String name, int price, FieldController fieldController) {
		super(fieldController, name, price);
	}

	@Override
	public int getRent() {
		
		int numberOfShipping = this.getOwner().getAccount().getNumberOfFields(Shipping.class);

		if(numberOfShipping > 0){
			return (int) (baseRent * Math.pow(2, --numberOfShipping));
		}
		return 0;

	}

	@Override
	public String toString() {
		if(getOwner() == null)
			return "Pris: "+getPrice();
		else
			return "Leje: "+getRent();
	}
	
	@Override
	public String getDescription() {
		return "Lejen øges for hvert rederi der ejes af ejeren: " +
				"1: " + (baseRent * 1) +
				"2: " + (baseRent * 2) +
				"3: " + (baseRent * 4) +
				"4: " + (baseRent * 8);
	}

	@Override
	public void reset() {}
}
